<template>
	<view>
		<view class="username">{{username}}</view>
		<view v-if="msg==''">
			<button @click="mobileOkPcLogin()">确认登录</button>
		</view>
		<view class="msg" v-else>
			{{msg}}
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				sessionId:'',
				token:'',
				httpUrl:'',
				username:'',
				msg: ''
			}
		},
		onLoad(option){
			this.sessionId=option.sessionId;
			this.token=option.token;
			this.httpUrl=option.httpUrl;
			this.username=option.username;
			console.log(option);
		},
		methods: {
			mobileOkPcLogin(){
				let _this=this;
				let requestUrl=this.httpUrl+'/user/mobileOkPcLogin'
				uni.request({
					method:'POST',
				    url: requestUrl,
					header:{
						"Content-Type": "application/x-www-form-urlencoded"
					},
				    data: {
				        sessionId: this.sessionId,
						token:this.token
				    },
				    success: (res) => {
						let resultData=res.data;
					    _this.msg=resultData.msg;
						console.log(resultData);
				    }
				});
			}
		}
	}
</script>

<style>
.username{
	text-align: center;
	font-size: 32rpx;
	line-height: 50rpx;
}
.msg{
	text-align: center;
	font-size: 30rpx;
	margin-top: 10rpx;
}
</style>
